<template>
    <div>
        <h1>Second组件</h1>
        <div>{{fromBrotherMsg}}</div>
    </div>
</template>

<script>
import bus from '@/utils/eventBus'
export default {
    data(){
        return{
            fromBrotherMsg:''
        }
    },
    //调用组件创建完之后会被调用
    created(){
       bus.$on('sharekey',val=>{
        this.fromBrotherMsg=val
       })
    }
}
</script>

<style>

</style>